load("//:build_variables.bzl", "COPTS")
load("//tools/lint:linters.bzl", "clang_tidy_test")

package(
    default_visibility = ["//:android_cuttlefish"],
)

cc_library(
    name = "cas_downloader",
    srcs = ["cas_downloader.cpp"],
    hdrs = ["cas_downloader.h"],
    copts = COPTS,
    deps = [
        "//cuttlefish/common/libs/fs",
        "//cuttlefish/common/libs/utils:environment",
        "//cuttlefish/common/libs/utils:files",
        "//cuttlefish/common/libs/utils:json",
        "//cuttlefish/common/libs/utils:result",
        "//cuttlefish/common/libs/utils:subprocess",
        "//cuttlefish/host/libs/web/cas:cas_flags",
        "//libbase",
        "@jsoncpp",
    ],
)

clang_tidy_test(
    name = "cas_downloader_clang_tidy",
    srcs = [":cas_downloader"],
    tags = ["clang_tidy", "clang-tidy"],
)

cc_test(
    name = "cas_downloader_test",
    srcs = ["cas_downloader_test.cpp"],
    copts = COPTS,
    deps = [
        "//cuttlefish/common/libs/utils:files",
        "//cuttlefish/common/libs/utils:flag_parser",
        "//cuttlefish/common/libs/utils:result",
        "//cuttlefish/common/libs/utils:result_matchers",
        "//cuttlefish/host/libs/web/cas:cas_downloader",
        "//cuttlefish/host/libs/web/cas:cas_flags",
        "//libbase",
        "@fmt",
        "@googletest//:gtest",
        "@googletest//:gtest_main",
    ],
)

clang_tidy_test(
    name = "cas_downloader_test_clang_tidy",
    srcs = [":cas_downloader_test"],
    tags = ["clang_tidy", "clang-tidy"],
)

cc_library(
    name = "cas_flags",
    srcs = ["cas_flags.cc"],
    hdrs = ["cas_flags.h"],
    copts = COPTS,
    deps = [
        "//cuttlefish/common/libs/utils:flag_parser",
        "//cuttlefish/common/libs/utils:result",
        "//libbase",
    ],
)

clang_tidy_test(
    name = "cas_flags_clang_tidy",
    srcs = [":cas_flags"],
    tags = ["clang_tidy", "clang-tidy"],
)
